<template>
  <a-form :model="newData">
    <a-row :gutter="24">
      <a-col :span="4">
        <a-form-item label="科室" label-col-flex="80px">
          <a-input v-model="newData.dept" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="床位" label-col-flex="80px">
          <a-input v-model="newData.bed" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="住院号" label-col-flex="80px">
          <a-input v-model="newData.num" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="姓名" label-col-flex="80px">
          <a-input v-model="newData.name" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="性别" label-col-flex="80px">
          <a-input v-model="newData.sex" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="年龄" label-col-flex="80px">
          <a-input v-model="newData.age" />
        </a-form-item>
      </a-col>
    </a-row>
    <a-row :gutter="24">
      <a-col :span="4">
        <a-form-item label="费别" label-col-flex="80px">
          <a-input v-model="newData.feibie" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="入院日期" label-col-flex="80px">
          <a-input v-model="newData.riqi" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="住院天数" label-col-flex="80px">
          <a-input v-model="newData.tianshu" />
        </a-form-item>
      </a-col>
      <a-col :span="4">
        <a-form-item label="体重" label-col-flex="80px">
          <a-input v-model="newData.tizhong" />
        </a-form-item>
      </a-col>
      <a-col :span="8">
        <a-form-item label="诊断" label-col-flex="80px">
          <a-input v-model="newData.zhenduan" />
        </a-form-item>
      </a-col>
    </a-row>
    <a-row :gutter="24">
      <a-col :span="8">
        <a-form-item label="既往史" label-col-flex="80px">
          <a-input v-model="newData.jiwangshi" />
        </a-form-item>
      </a-col>
      <a-col :span="8">
        <a-form-item label="过敏史" label-col-flex="80px">
          <a-input v-model="newData.guominshi" />
        </a-form-item>
      </a-col>
      <a-col :span="8">
        <a-form-item label="家族史" label-col-flex="80px">
          <a-input v-model="newData.jiazushi" />
        </a-form-item>
      </a-col>
    </a-row>
  </a-form>
</template>

<script lang="ts" setup>
  import { watch, ref } from 'vue';

  const { itemData } = defineProps({
    itemData: {
      type: Object,
      default: () => ({}),
    },
  });
  const newData = ref({ ...itemData });
  watch(
    () => itemData,
    (newVal) => {
      newData.value = { ...newVal };
    }
  );
</script>
